package com.example.actearly_revised;

import android.content.Context;
import android.widget.Toast;

public class Question_Node {

	public int answer;
	public String question;
	//public int q_id;
	public String getQuestion() {
		return question;
	}

	public int q_id;
	public  boolean flag_answered = false;

	public Question_Node( String question, int answer, int q_id){
		this.question = question;
		this.answer = answer;
		this.q_id = q_id;
	}

	public void changeAnswer(int answer, Context context, int profile_number){
		System.out.println("?????????????????>>>"+ flag_answered + "   " + question);
		String temp = "";
		this.answer = answer;
		if(answer == 0){
			temp = "yes";
		}
		else if(answer == 1){
			temp = "no";
		}
		else if(answer == 2){
			temp = "notsure";
		}
		System.out.println(">>>>>>>>>>>>>>>>>>AAAAAAAAA"+ profile_number);
		Change_of_Answer_Database.Change_of_Answer_Database(temp, q_id, profile_number);
		System.out.println(">>>>>>>>>>>>>>>>>>AAAAAAAAA"+ profile_number);
		if(flag_answered == true){
			CharSequence text = "Answer Changed";
			
		//	Context context = getApplicationContext();
			int duration = Toast.LENGTH_SHORT;
			Toast toast = Toast.makeText(context, text, duration);
			toast.show();
		}
		System.out.println("answer++++++++++"+this.answer);
	}

	public String get(){
		return question;
	}
	public int getAnswer(){
		return answer;
	}
	
	public void setFlag(){
		this.flag_answered = true;
	}

}
	

